package
{
	import com.krds.IProduct;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	
	public final class MovieController
	{
		private static var counter:uint;
		private static var pool:Vector.<IProduct>;
		
		public static function initialize():void
		{
			pool = new Vector.<IProduct>(10);
		}

		public static function getIProduct():IProduct
		{
			if ( counter > 0 )
				return currentSprite = pool[--counter];
			
			var i:uint = GROWTH_VALUE;
			while( --i > -1 )
				pool.unshift ( new Sprite() );
			counter = GROWTH_VALUE;
			return getMovieClip();
		}
		public static function disposeSprite(disposedProduct:IProduct):void
		{
			pool[counter++] = disposedProduct;
		}
	}
}